package com.project.lk.nurseapp.nurse.presenter;

import com.project.lk.nurseapp.base.BaseApi;
import com.project.lk.nurseapp.base.BasePresenter;
import com.project.lk.nurseapp.base.ModelPresenterBridge;
import com.project.lk.nurseapp.home.usermsg.model.PostFileHintBean;
import com.project.lk.nurseapp.login.model.HintBean;
import com.project.lk.nurseapp.nurse.model.EvaluateChatModel;
import com.project.lk.nurseapp.nurse.model.GetIMItemBean;
import com.project.lk.nurseapp.nurse.model.GetIMModel;
import com.project.lk.nurseapp.nurse.model.PostFileModel;
import com.project.lk.nurseapp.nurse.model.SendMsgModel;

import java.util.List;

/**
 * 功能介绍：
 * 项目名：
 * 模块名称：
 * 作者：LK
 * 日期：2018/1/9
 * 修改日期：
 */
public class NursePresenter extends BasePresenter<INurseView>  implements ModelPresenterBridge{

    GetIMModel getIMModel;
    PostFileModel postFileModel;
    SendMsgModel sendMsgModel;
    EvaluateChatModel evaluateChatModel;
    public NursePresenter(INurseView  view){
        addView(view);
        getIMModel=new GetIMModel();
        postFileModel=new PostFileModel();
        sendMsgModel=new SendMsgModel();
        evaluateChatModel=new EvaluateChatModel();
        evaluateChatModel.setBridge(this);
        sendMsgModel.setBridge(this);
        getIMModel.setBridge(this);
        postFileModel.setBridge(this);

    }

    //评论
    public void evaluateChat(String url,String sessionId,String star,String content){
        evaluateChatModel.postLoadJson(url,sessionId,star,content);
    }
    public void postFileData(String url,String path,String sendType){
        postFileModel.postLoadJson(url,path,sendType);
    }
    public List<GetIMItemBean> getIMItemBeanList(){
        return getIMModel.getmList();
    }

    public void getFirstIM(String url,String msgType,String msg){
        getIMModel.postLoadJson(url,msgType,msg);
    }

    public List<HintBean> getHintList(){
        return sendMsgModel.getHintList();
    }


    public void sendMsg(String url, String sessionId,String content, String msgType){
        sendMsgModel.postLoadJson(url,sessionId,content,msgType);
    }
    public List<PostFileHintBean> getVideoList(){
        return postFileModel.getVideoList();
    }
    public List<PostFileHintBean> getAudioList(){
        return postFileModel.getAudioList();
    }
    public List<PostFileHintBean> getImgList(){
        return postFileModel.getImgList();
    }
    @Override
    public void bridge(int action, List list) {

        if (view!=null) {
            switch (action){
                case BaseApi.get_im_success:
                    view.getIMSuccess();
                    break;
                case BaseApi.get_im_fail:
                    view.getIMFail();
                    break;
                case BaseApi.img_success:
                    view.imgSuccess();
                    break;
                case BaseApi.img_fail:
                    view.imgFail();
                    break;
                case BaseApi.video_success:
                    view.videoSuccess();
                    break;
                case BaseApi.video_fail:
                    view.videoFail();
                    break;
                case BaseApi.audio_success:
                    view.audioSuccess();
                    break;
                case BaseApi.audio_fail:
                    view.audioFail();
                    break;
                case BaseApi.send_video_success:
                    view.sendVideoSuccess();
                    break;
                case BaseApi.send_video_fail:
                    view.sendVideoFail();
                    break;
                case BaseApi.send_audio_success:
                    view.sendAudioSuccess();
                    break;
                case BaseApi.send_audio_fail:
                    view.sendAudioFail();
                    break;
                case BaseApi.send_img_success:
                    view.sendImgSuccess();
                    break;
                case BaseApi.send_img_fail:
                    view.sendImgFail();
                    break;
                case BaseApi.send_text_success:
                    view.sendTextSuccess();
                    break;
                case BaseApi.send_text_fail:
                    view.sendTextFail();
                    break;
            }
        }
    }
}
